<?php
require_once '../sub/init.php';
require_once ZEAI.'m/shop_chk_u.php';
$longitude = (empty($longitude))?0:$longitude;
$latitude  = (empty($latitude))?0:$latitude;
$areatitle = trimhtml($areatitle);
switch ($submitok) {
	case 'u_update':
		if(ifint($cook_uid)){
			$longitude = trimhtml(dataIO($lng,'in',20));
			$latitude  = trimhtml(dataIO($lat,'in',20));
			$showtype = intval($showtype);
			$db->query("UPDATE ".__TBL_USER__." SET longitude='$longitude',latitude='$latitude' WHERE id=".$cook_uid);
			setcookie("cook_longitude",$longitude,time()+31536000,"/",$_ZEAI['CookDomain']);
			setcookie("cook_latitude",$latitude,time()+31536000,"/",$_ZEAI['CookDomain']);
			json_exit(array('flag'=>1,'msg'=>'标注成功','url'=>HOST.'?t=gps&showtype='.$showtype));
		}
	break;
	case 'shop_qh_update':
		if(ifint($cook_tg_uid)){
			$qhlongitude = trimhtml(dataIO($lng,'in',20));
			$qhlatitude  = trimhtml(dataIO($lat,'in',20));
			$db->query("UPDATE ".__TBL_TG_USER__." SET qhlongitude='$qhlongitude',qhlatitude='$qhlatitude' WHERE id=".$cook_tg_uid);
			json_exit(array('flag'=>1,'msg'=>'标注成功','url'=>'shop_my_shop_adm.php'));
		}
	break;
	case 'shop_address_update':
		if(ifint($cook_tg_uid)){
			$longitude = trimhtml(dataIO($lng,'in',20));
			$latitude  = trimhtml(dataIO($lat,'in',20));
			$db->query("UPDATE ".__TBL_TG_USER__." SET longitude='$longitude',latitude='$latitude' WHERE id=".$cook_tg_uid);
			json_exit(array('flag'=>1,'msg'=>'标注成功','url'=>'shop_my_shop_adm.php'));
		}
	break;
}
?>
<!doctype html><html><head><meta charset="utf-8">
<title>标注位置<?php echo '-'.$_ZEAI['siteName'];?></title>
<head>
<?php echo HEADMETA;?>
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style type="text/css">
.maptop{width:100%;position:absolute;top:5.5rem;left:0;text-align:left;color:#999}
.maptop .sobox{width:90%;height:4rem;line-height:4rem;margin:0 auto;position:relative;border:#dedede 1px solid;border-radius:.3rem}
.maptop .sobox .input{width:-webkit-calc(100% - 4rem);line-height:3rem;height:3rem;margin-top:.5rem;text-indent:.8rem;float:left;border:0}
.maptop .sobox .so{border:0;color:#999;background-color:#fff;width:4rem;height:3rem;line-height:3rem;margin-top:.5rem;display:inline-block;float:right;border-left:#eee 1px solid}
.maptop .sobox .so i{font-size:2.2rem}
.maptop span{display:inline-block;position:absolute;left:3rem;top:4.5rem;font-size:1.4rem}
.maptop input.tips{border:0;line-height:4rem;width:8rem;display:inline;color:#666;background-color:#fff;font-size:1.4rem}
#zeai_map {width:100%;height:-webkit-calc(100% - 15rem);overflow:hidden;position:absolute;bottom:0;left:0;z-index:1}
.savebtn{position:fixed;top:.7rem;width:6rem;right:1rem;z-index:2;line-height:3.6rem;height:3.6rem;color:#fff;border-radius:.4rem;border:0;font-size:1.6rem}
</style>
</head>
<body>
<?php
$mini_title='当前地图标注';
$mini_class='top_mini4';
$mini_L = (empty($mini_L))?'<em onClick="zeai.back()"><i class="ico" >&#xeaca;</i></em>':$mini_L;

require_once ZEAI.'m/top_mini.php';?>
<div class="maptop">
	<form id="www_zeai_cn__RORM">
    	<div class="sobox">
            <input id="keyword" class="input" type="text" placeholder="搜索城市/街道/小区" autocomplete="off" />
            <button type="button" onClick="searchMap()" class="so" title="开始搜索" /><i class="ico">&#xe6c4;</i></button>
        </div>
        <span>经度：<input type="text" id="lng" name="lng" value="<?php echo $longitude;?>" class="tips" readonly />　纬度：<input type="text" id="lat" name="lat" class="tips" value="<?php echo $latitude;?>" readonly /></span>
        <input type="hidden" id="areatitle" value="<?php echo $areatitle;?>">
        <input type="hidden" name="showtype" value="<?php echo $showtype;?>">
        <input type="hidden" value="<?php echo $kind;?>_update" name="submitok">
    </form>
</div>
<button id="zeai_map_save_btn" class="savebtn zeaibg">保存</button>
<div id="zeai_map" style="width:100%"></div>
<script src="<?php echo $http;?>//api.map.baidu.com/api?v=2.0&ak=IFuufk9vV9YgxQhXYgFCAfxdWenRv51j"></script>
<script src="<?php echo RES;?>m/js/zeai_map.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>
//zeai.alert('拖动地图上红色的【标注】<i class="ico Cf00">&#xe624;</i> 图标定位您所在区域，点底部【确定并保存】按钮即可；也可以搜索你的地点');
zeai_map_save_btn.onclick=function(){
	Zeai_map_save(function(rs){
		zeai.ajax({url:'map_set'+zeai.extname,form:www_zeai_cn__RORM},function(e){var rs=zeai.jsoneval(e);
			zeai.msg(0);zeai.msg(rs.msg);
			if(rs.flag==1){setTimeout(function(){
				zeai.openurl(rs.url);
			},1000);}
		});
	});
}
</script>
<iframe height="0" width="0" src="https://api.map.baidu.com/res/staticPages/location.html?timeout=5000&maximumAge=600000&type=2" style="border-width: 0px;"></iframe>
</body>
</html>